package com.iflytek.edu.pdc.uc.elasticsearch.support;

import java.io.Serializable;
import java.util.Date;

public class School implements Serializable {

    private static final long serialVersionUID = 4189432602404412078L;



    /**
     * 学校id主键
     */
    private String id;
    /**
     * 删除标记，0正常，1已删除
     */
    private String delFlg;
    /**
     *学校编码(学校编码，国家标准的)
     */
    private String schoolCode;
    /**
     * 学校名
     */
    private String schoolName;
    /**
     * 英文名称
     */
    private String schoolEnName;
    /**
     * 学校简称
     */
    private String shortName;
    /**
     * 地址
     */
    private String address;
    /**
     * 电话
     */
    private String mobile;
    /**
     * 传真
     */
    private String fax;
    /**
     * 电子邮箱
     */
    private String email;
    /**
     * 备注
     */
    private String remark;
    /**
     * 国家id
     */
    private String countryId;
    /**
     * 省份id
     */
    private String provinceId;
    /**
     * 市id
     */
    private String cityId;
    /**
     * 区县id
     */
    private String districtId;
    /**
     * 父级教育机构id
     */
    private String parentEduOrgId;
    /**
     * 父级校id，可以为学校id或者集团校
     */
    private String parentSchoolId;
    /**
     * 联系人
     */
    private String contact;
    /**
     * 邮编
     */
    private String postcode;
    /**
     * 是否为分校，0本校1分校
     */
    private String isBranchSchool;
    /**
     * 学制，字典
     */
    private String eduSystem;
    /**
     * 学校所拥有的学段（为了兼容老服务）
     */
    private String phaseCode;
    /**
     * 学校所拥有的年级（为了兼容老服务）
     */
    private String gradeCode;
    /**
     * 学校状态，1：未认证，2：处理中，3：已清理，4：已认证，5：测试，6；演示
     */
    private String schoolLabel;
    /**
     * 学校网址
     */
    private String schoolUrl;
    /**
     * 学校状态的更新时间
     */
    private Date updateLabelTime;

    private String typeCode;
    /**
     * 应用名称（兼容老接口，新接口全部不处理该字段）
     */
    private String appName;
    /**
     * 创建者
     */
    private String creator;
    /**
     * 创建时间
     */
    private Date createTime;
    /**
     * 修改者
     */
    private String modificator;
    /**
     * 修改时间
     */
    private Date updateTime;
    /**
     * 区域id
     */
    private String areaId;

    public String getId() {
        return id;
    }

    public String getDelFlg() {
        return delFlg;
    }

    public String getSchoolCode() {
        return schoolCode;
    }

    public String getSchoolName() {
        return schoolName;
    }

    public String getSchoolEnName() {
        return schoolEnName;
    }

    public String getShortName() {
        return shortName;
    }

    public String getAddress() {
        return address;
    }

    public String getMobile() {
        return mobile;
    }

    public String getFax() {
        return fax;
    }

    public String getEmail() {
        return email;
    }

    public String getRemark() {
        return remark;
    }

    public String getCountryId() {
        return countryId;
    }

    public String getProvinceId() {
        return provinceId;
    }

    public String getCityId() {
        return cityId;
    }

    public String getDistrictId() {
        return districtId;
    }

    public String getParentEduOrgId() {
        return parentEduOrgId;
    }

    public String getParentSchoolId() {
        return parentSchoolId;
    }

    public String getContact() {
        return contact;
    }

    public String getPostcode() {
        return postcode;
    }

    public String getIsBranchSchool() {
        return isBranchSchool;
    }

    public String getEduSystem() {
        return eduSystem;
    }

    public String getPhaseCode() {
        return phaseCode;
    }

    public String getGradeCode() {
        return gradeCode;
    }

    public String getSchoolLabel() {
        return schoolLabel;
    }

    public String getSchoolUrl() {
        return schoolUrl;
    }

    public Date getUpdateLabelTime() {
        return updateLabelTime;
    }

    public String getTypeCode() {
        return typeCode;
    }

    public String getAppName() {
        return appName;
    }

    public String getCreator() {
        return creator;
    }

    public String getModificator() {
        return modificator;
    }

    public void setId(String id) {
        this.id = id;
    }

    public void setDelFlg(String delFlg) {
        this.delFlg = delFlg;
    }

    public void setSchoolCode(String schoolCode) {
        this.schoolCode = schoolCode;
    }

    public void setSchoolName(String schoolName) {
        this.schoolName = schoolName;
    }

    public void setSchoolEnName(String schoolEnName) {
        this.schoolEnName = schoolEnName;
    }

    public void setShortName(String shortName) {
        this.shortName = shortName;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public void setFax(String fax) {
        this.fax = fax;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public void setCountryId(String countryId) {
        this.countryId = countryId;
    }

    public void setProvinceId(String provinceId) {
        this.provinceId = provinceId;
    }

    public void setCityId(String cityId) {
        this.cityId = cityId;
    }

    public void setDistrictId(String districtId) {
        this.districtId = districtId;
    }

    public void setParentEduOrgId(String parentEduOrgId) {
        this.parentEduOrgId = parentEduOrgId;
    }

    public void setParentSchoolId(String parentSchoolId) {
        this.parentSchoolId = parentSchoolId;
    }

    public void setContact(String contact) {
        this.contact = contact;
    }

    public void setPostcode(String postcode) {
        this.postcode = postcode;
    }

    public void setIsBranchSchool(String isBranchSchool) {
        this.isBranchSchool = isBranchSchool;
    }

    public void setEduSystem(String eduSystem) {
        this.eduSystem = eduSystem;
    }

    public void setPhaseCode(String phaseCode) {
        this.phaseCode = phaseCode;
    }

    public void setGradeCode(String gradeCode) {
        this.gradeCode = gradeCode;
    }

    public void setSchoolLabel(String schoolLabel) {
        this.schoolLabel = schoolLabel;
    }

    public void setSchoolUrl(String schoolUrl) {
        this.schoolUrl = schoolUrl;
    }

    public void setUpdateLabelTime(Date updateLabelTime) {
        this.updateLabelTime = updateLabelTime;
    }

    public void setTypeCode(String typeCode) {
        this.typeCode = typeCode;
    }

    public void setAppName(String appName) {
        this.appName = appName;
    }

    public void setCreator(String creator) {
        this.creator = creator;
    }


    public void setModificator(String modificator) {
        this.modificator = modificator;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getAreaId() {
        if(isBlank(this.areaId)){
            if(!isBlank(this.districtId)){
                setAreaId(this.districtId);
                return this.districtId;
            }
            if(!isBlank(this.cityId)){
                setAreaId(this.cityId);
                return this.cityId;
            }
            if(!isBlank(this.provinceId)){
                setAreaId(this.provinceId);
                return this.provinceId;
            }
            if(!isBlank(this.countryId)){
                setAreaId(this.countryId);
                return this.countryId;
            }
        }
        return areaId;
    }

    public void setAreaId(String areaId) {
        this.areaId = areaId;
    }



    @Override
    public boolean equals(Object o) {
        if (this == o){
            return true;
        }
        if (o == null || getClass() != o.getClass()){
            return false;
        }
        School school = (School) o;
        return id.equals(school.id);
    }

    /**
     * 判断字符串是否为空
     * @param cs
     * @return
     */
    public static boolean isBlank(CharSequence cs) {
        int strLen;
        if (cs != null && (strLen = cs.length()) != 0) {
            for(int i = 0; i < strLen; ++i) {
                if (!Character.isWhitespace(cs.charAt(i))) {
                    return false;
                }
            }

            return true;
        } else {
            return true;
        }
    }

    @Override
    public int hashCode() {
        return id.hashCode();
    }

    @Override
    public String toString() {
        return "School{" +
                "id='" + id + '\'' +
                ", delFlg='" + delFlg + '\'' +
                ", schoolCode='" + schoolCode + '\'' +
                ", schoolName='" + schoolName + '\'' +
                ", schoolEnName='" + schoolEnName + '\'' +
                ", shortName='" + shortName + '\'' +
                ", address='" + address + '\'' +
                ", mobile='" + mobile + '\'' +
                ", fax='" + fax + '\'' +
                ", email='" + email + '\'' +
                ", remark='" + remark + '\'' +
                ", countryId='" + countryId + '\'' +
                ", provinceId='" + provinceId + '\'' +
                ", cityId='" + cityId + '\'' +
                ", districtId='" + districtId + '\'' +
                ", parentEduOrgId='" + parentEduOrgId + '\'' +
                ", parentSchoolId='" + parentSchoolId + '\'' +
                ", contact='" + contact + '\'' +
                ", postcode='" + postcode + '\'' +
                ", isBranchSchool='" + isBranchSchool + '\'' +
                ", eduSystem='" + eduSystem + '\'' +
                ", phaseCode='" + phaseCode + '\'' +
                ", gradeCode='" + gradeCode + '\'' +
                ", schoolLabel='" + schoolLabel + '\'' +
                ", schoolUrl='" + schoolUrl + '\'' +
                ", updateLabelTime=" + updateLabelTime +
                ", typeCode='" + typeCode + '\'' +
                ", appName='" + appName + '\'' +
                ", creator='" + creator + '\'' +
                ", createTime=" + createTime +
                ", modificator='" + modificator + '\'' +
                ", updateTime=" + updateTime +
                ", areaId='" + areaId + '\'' +
                '}';
    }
}
